package com.xuxin.pda.presenter;

import com.xuxin.pda.bean.BaseBean;
import com.xuxin.pda.bean.TrashSummaryBean;
import com.xuxin.pda.contract.TrashSummaryContract;
import com.xuxin.pda.model.TrashSummaryModel;

/**
 * Created by xu_xin
 * Created on 2021/2/7 0007
 */
public class TrashSummaryPresenter implements TrashSummaryContract.Presenter {
    private final TrashSummaryModel model;
    private final TrashSummaryContract.View view;

    public TrashSummaryPresenter(TrashSummaryContract.View view) {
        this.view = view;
        model = new TrashSummaryModel();
    }

    @Override
    public void getTrashSummary(String year, String month, String day, String In_MOrD) {
        if (null != model) {
            model.getTrashSummary(this, year, month, day, In_MOrD);
        }
    }

    @Override
    public void onSuccess(TrashSummaryBean trashSummaryBean) {
        if (null != view) {
            view.onSuccess(trashSummaryBean);
        }
    }

    /**
     * 以下内容复用
     */
    @Override
    public void onError(BaseBean baseBean) {
        if (null != view) {
            view.onError(baseBean);
        }
    }

    @Override
    public void onComplete() {
        if (null != view) {
            view.onComplete();
        }
    }
}